Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove tokenstream::Delimited. #56369

Merged
merged 1 commit into from
Dec 10, 2018
Merged

Conversation

nnethercote
Copy link
Contributor

Because it's an extra type layer that doesn't really help; in a couple
of places it actively gets in the way, and overall removing it makes the
code nicer. It does, however, move tokenstream::TokenTree further away
from the TokenTree in quote.rs.

More importantly, this change reduces the size of TokenStream from 48
bytes to 40 bytes on x86-64, which is enough to slightly reduce
instruction counts on numerous benchmarks, the best by 1.5%.

Note that open_tt and close_tt have gone from being methods on
Delimited to associated methods of TokenTree.

@rust-highfive
Copy link
Collaborator

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 30, 2018
@eddyb eddyb added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 30, 2018
@eddyb
Copy link
Member

eddyb commented Nov 30, 2018

Marking as blocked on #49219.

cc @dtolnay @alexcrichton

@nnethercote
Copy link
Contributor Author

Why is it blocked on #49219?

@bors
Copy link
Contributor

bors commented Nov 30, 2018

☔ The latest upstream changes (presumably #49219) made this pull request unmergeable. Please resolve the merge conflicts.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels Nov 30, 2018
@petrochenkov
Copy link
Contributor

@nnethercote
You'll see it when you start rebasing :)

@petrochenkov petrochenkov self-assigned this Nov 30, 2018
@Centril
Copy link
Contributor

Centril commented Nov 30, 2018

#49219 has landed; @nnethercote should be able to rebase this now. :)

@nnethercote
Copy link
Contributor Author

@eddyb: I have rebased.

@@ -146,15 +102,15 @@ impl TokenTree {
pub fn span(&self) -> Span {
match *self {
TokenTree::Token(sp, _) => sp,
TokenTree::Delimited(sp, _) => sp.entire(),
TokenTree::Delimited(sp, _, _) => sp.entire(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: _, _ -> ..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(There are many instances of this.)

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Dec 10, 2018

📌 Commit 8e4ccef845e2870b60b08d77960b550f13ade2d3 has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 10, 2018
@petrochenkov
Copy link
Contributor

In case you'll want to fix #56369 (comment)
@bors delegate+

@bors
Copy link
Contributor

bors commented Dec 10, 2018

✌️ @nnethercote can now approve this pull request

Because it's an extra type layer that doesn't really help; in a couple
of places it actively gets in the way, and overall removing it makes the
code nicer. It does, however, move `tokenstream::TokenTree` further away
from the `TokenTree` in `quote.rs`.

More importantly, this change reduces the size of `TokenStream` from 48
bytes to 40 bytes on x86-64, which is enough to slightly reduce
instruction counts on numerous benchmarks, the best by 1.5%.

Note that `open_tt` and `close_tt` have gone from being methods on
`Delimited` to associated methods of `TokenTree`.
@nnethercote
Copy link
Contributor Author

I addressed the nits.

@bors r=petrochenkov

@bors
Copy link
Contributor

bors commented Dec 10, 2018

📌 Commit 1fe2c03 has been approved by petrochenkov

@bors
Copy link
Contributor

bors commented Dec 10, 2018

⌛ Testing commit 1fe2c03 with merge 286dc37...

bors added a commit that referenced this pull request Dec 10, 2018
Remove `tokenstream::Delimited`.

Because it's an extra type layer that doesn't really help; in a couple
of places it actively gets in the way, and overall removing it makes the
code nicer. It does, however, move `tokenstream::TokenTree` further away
from the `TokenTree` in `quote.rs`.

More importantly, this change reduces the size of `TokenStream` from 48
bytes to 40 bytes on x86-64, which is enough to slightly reduce
instruction counts on numerous benchmarks, the best by 1.5%.

Note that `open_tt` and `close_tt` have gone from being methods on
`Delimited` to associated methods of `TokenTree`.
@bors
Copy link
Contributor

bors commented Dec 10, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: petrochenkov
Pushing 286dc37 to master...

@bors bors merged commit 1fe2c03 into rust-lang:master Dec 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants